package org.example.fivedemo;

public class Teacher {

    public String name;  //姓名
    public int age;  //年龄
    public double salary;  //工资


    //出现有参构造时一定要定义无参构造
    public Teacher() {
    }

    //创建有参构造器，为上面三个属性赋值做准备
    public Teacher(String name, int age, double salary) {
        this.name = name;  //this.name  中的this指的是指向本类的成员变量， this.name中的name指的是本类中的public String name;中的name
        this.age = age;
        this.salary = salary;
    }
}
